package com.example.tests;

import java.util.Set;
import org.testng.annotations.Test;
import com.example.data.ContactData;
import com.example.data.GroupData;

public class ContactCreationTest extends TestBase {

	@Test(dataProvider="contactsFromFile", dataProviderClass = ContactDataGenerator.class)
	public void contactCreationTest(ContactData contact) throws Exception {
		//go to home(contacts) page and get list of contacts
		Set<ContactData> oldList = manager.getContactHelper().getContactsList();
		GroupData groupToSelect = manager.getContactHelper().setRandomGroupInContact(contact); 
		//then create contact and put to created group
		manager.getContactHelper().createContact(contact, groupToSelect);
		//manager.getContactHelper().returnToHomePage();
		Set<ContactData> newList = manager.getContactHelper().getContactsList();
		//compare lists
		verifyContactAdded(oldList, contact, newList);
	}
	

}
